home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / assembly / cache.lha / cache.txt < prev    next >
Encoding:
Text File  |  1993-03-17  |  3.7 KB  |  112 lines

  1.  
  2. In article <1993Mar9.050011.11430@odin.diku.dk>,
  3.         suzy@diku.dk (Rune F. Skardhamar) writes:
  4.  
  5.  > Anybody out there who knows how to disable the data- and instr cache's
  6.  > in the 68020+ from assembler? [...]
  7.  
  8. Here's the nice way:
  9.  
  10. ;----------------------------------- exec.library -------------------------
  11. exec.library/CacheControl                            exec.library/CacheControl
  12.  
  13.    NAME
  14.         CacheControl - Instruction & data cache control (V37)
  15.  
  16.    SYNOPSIS
  17.         oldBits = CacheControl(cacheBits,cacheMask)
  18.         D0                     D0        D1
  19.  
  20.         ULONG CacheControl(ULONG,ULONG);
  21.  
  22.    FUNCTION
  23.         This function provides global control of any instruction or data
  24.         caches that may be connected to the system.  All settings are
  25.         global -- per task control is not provided.
  26.  
  27.         The action taken by this function will depend on the type of
  28.         CPU installed.  This function may be patched to support external
  29.         caches, or different cache architectures.  In all cases the function
  30.         will attempt to best emulate the provided settings.  Use of this
  31.         function may save state specific to the caches involved.
  32.  
  33.         The list of supported settings is provided in the exec/execbase.i
  34.         include file.  The bits currently defined map directly to the Motorola
  35.         68030 CPU CACR register.  Alternate cache solutions may patch into
  36.         the Exec cache functions.  Where possible, bits will be interpreted to
  37.         have the same meaning on the installed cache.
  38.  
  39.    INPUTS
  40.         cacheBits - new values for the bits specified in cacheMask.
  41.  
  42.         cacheMask - a mask with ones for all bits to be changed.
  43.  
  44.    RESULT
  45.         oldBits   - the complete prior values for all settings.
  46.  
  47.    NOTE
  48.         As a side effect, this function clears all caches.
  49.  
  50.    SEE ALSO
  51.         exec/execbase.i, CacheClearU(), CacheClearE()
  52.  
  53. ;--------------------------------- exec/execbase.i ------------------------
  54. **
  55. **      $Filename: exec/execbase.i $
  56. **      $Release: 2.04 Includes, V37.4 $
  57. **      $Revision: 36.16 $
  58. **      $Date: 91/10/10 $
  59. **
  60. **      Definition of the exec.library base structure.
  61. **
  62. **      (C) Copyright 1985-1991 Commodore-Amiga, Inc.
  63. **          All Rights Reserved
  64. **
  65.  
  66. [stuff deleted]
  67.  
  68. ******* Selected bit definitions for Cache manipulation calls **************
  69.  
  70.         BITDEF  CACR,EnableI,0          ;Enable instruction cache
  71.         BITDEF  CACR,FreezeI,1          ;Freeze instruction cache
  72.         BITDEF  CACR,ClearI,3           ;Clear instruction cache
  73.         BITDEF  CACR,IBE,4              ;Instruction burst enable
  74.         BITDEF  CACR,EnableD,8          ;68030 Enable data cache
  75.         BITDEF  CACR,FreezeD,9          ;68030 Freeze data cache
  76.         BITDEF  CACR,ClearD,11          ;68030 Clear data cache
  77.         BITDEF  CACR,DBE,12             ;68030 Data burst enable
  78.         BITDEF  CACR,WriteAllocate,13   ;68030 Write-Allocate mode (must
  79.                                 ;always be set)
  80.         BITDEF  CACR,CopyBack,31        ;Master enable for copyback caches
  81.  
  82. [stuff deleted]
  83.  
  84. ;------------------------------------ cut here ----------------------------
  85.  
  86. and here is the not so nice way:
  87.  
  88.                 [...]
  89.                 lea     (_CacheOff,PC),a5
  90.                 move.l  ($4).w,a6
  91.                 jsr     (_LVOSupervisor,a6)
  92.                 [...]
  93. _CacheOff:
  94.                 movec   #1<<13,CACR
  95.                 rte
  96.  
  97.  
  98.         bye, Peter
  99.  
  100. --
  101.   Peter Simons - Germany, Usenet: simons@peti.GUN.de, Phone: 0228 / 746061
  102.  
  103.                                       Supporting >Pretty Good Privacy v2.x<
  104. begin 777 PGPv2.1-Public-Key
  105. MF0!- BN$"XL   $" ,K.C1"/&23&5_C_MH8:41%!G8\47TD--#&EPDQ<KR'2X
  106. MNJW+HO\8JREFI+:D9..NJW$& &SBD(YQL[R_R8=ZIF$ !1&T(5!E=&5R(%-IX
  107. 9;6]N<R \<VEM;VYS0'!E=&DN1U5.+F1E/KR_X
  108.  X
  109. end
  110.  
  111.  
  112.